In electronic systems, it is common for several requesters to share a common resource. Generally, requesters must gain access to the common resource by submitting a request. A priority scheme is used to select between the one or more pending requests to determine which requester will be granted access to the resource next.
Many priority schemes are known in the art. One common priority scheme utilizes a first-in first-out (FIFO) arrangement. According to this mechanism, requesters are serviced in the order in which they are presented. This mechanism does not allow any request types to receive priority over other types. It is therefore not optimally employed in systems that have time-critical requests.
A preemptive priority scheme addresses the foregoing shortcoming by assigning each requester a different level of priority. According to this arrangement, access to a shared resource is granted to the pending request having the highest priority level. Any request with a lower priority level must wait until the higher priority request has completed. While this solution assigns a relative importance to requests, thus allowing high-priority requests to complete relatively quickly, it may result in lower priority requests from being starved out. This will be the case if a high priority request is always pending to take precedence over lower priority requests.
Another common scheme uses a rotational priority arrangement. Requests that are pending at a particular moment in time are recorded in a “snapshot”. The requests in the snapshot will be processed in an order determined by a predetermined priority scheme. No additional requests will be considered for processing until all requests in the snapshot have gained access to the common resource. When all requests in the snapshot have been completed, another snapshot can be obtained and the process repeated. This mechanism ensures that low-level requests will not be starved out. All requesters have the opportunity to gain access to the shared resource according to the priority hierarchy that is adhered to within the snapshot. However, high priority requests can only gain access to the resource once per snapshot, which may not be adequate.
The above-described mechanisms are particularly unsuited for systems that benefit from precise performance tuning. For example, consider a data processing system having multiple processors coupled to a multi-tiered, hierarchical memory. The hierarchical memory includes a main memory interfacing to multiple shared caches that are each shared between respective processors. Each shared cache is further coupled to respective processors via one or more dedicated caches.
In the foregoing architecture, the instruction set of the processors includes various performance-enhancing instructions used to facilitate the transfer of instructions and data between levels in the hierarchical memory. For example, a processor may execute a flush instruction to cause certain data to be flushed from a first cache to a different cache or back to main memory. This allows the data to be more efficiently accessed by other processors within the system. Similarly, a processor may execute a pre-fetch instruction to cause specified data to be copied from the main memory to one or more caches in preparation of it being used by a processor. This reduces the access time for this data.
The types of performance enhancing instructions discussed above are generally not considered high-priority. For example, execution of an instruction to read data that is needed by the processor immediately should take precedence over a pre-fetch instruction being executed to obtain data that may be required in the future. On the other hand, the pre-fetch instruction should be allowed to complete execution so that the specified data is retrieved before the processor requires its use. Similar competing interests exist with the other types of performance enhancing instructions.
What is needed, therefore, is an improved system and method for prioritizing requests to a shared resource. This mechanism optimally allows a user to programmably fine-tune a selected priority scheme based on the requirements of each requester.